<%--
    Document   : addClient
    Created on : 21 avr. 2010, 15:16:28
    Author     : Sami
--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<!-- Ne pas oublier cette ligne sinon tous les tags de la JSTL seront ignorÃ©s ! -->
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
         <link rel="stylesheet" href="style.css" type="text/css" media="screen" />
        <script type="text/javascript" src="cart.js"></script>
        <script src="js/dojo.js" type="text/javascript"></script>
         <script src="js/vanadium-init.js" type="text/javascript"></script>

         <title>Cin&eacute;Shop</title>
    </head>

    <body>
    <div class="PageBackgroundGradient"></div>
    <div class="Main">
        <div class="Sheet">
            <div class="Sheet-tl"></div>
            <div class="Sheet-tr"><div></div></div>
            <div class="Sheet-bl"><div></div></div>
            <div class="Sheet-br"><div></div></div>
            <div class="Sheet-tc"><div></div></div>
            <div class="Sheet-bc"><div></div></div>
            <div class="Sheet-cl"><div></div></div>
            <div class="Sheet-cr"><div></div></div>
            <div class="Sheet-cc"></div>
            <div class="Sheet-body">
              <%@include file="header.jsp" %>
                <div class="contentLayout">
              <%@include file="menu.jsp" %>
                    <div class="content">
                        <c:if test="${param['action'] == 'creerUnUtilisateur'}"  >
                             <div align="center"><img src="images/addUser.png" title="Cr&eacute;er un client" alt="Add User"></div>
                        <table align="center">
                                <form action="ServletUsers" method="get">

                                    <tr><td> Nom :</td><td>&nbsp; <input type="text" name="nom" value="${requestScope['recup_nom']}"/><td></tr>
                                    <tr><td> Pr&eacute;nom :</td><td>&nbsp; <input type="text" name="prenom" value="${requestScope['recup_prenom']}"/></td></tr>
                                    <tr><td> Email :</td><td>&nbsp; <input type="text" name="email" value="${requestScope['recup_email']}"/></td></tr>
                                    <tr><td>Cr&eacute;ez un mot de passe : </td><td>&nbsp; <input type="password" name="password"/></td></tr>
                                    <tr><td> Retapez le mot de passe :</td><td>&nbsp; <input type="password" name="verif_password"/></td></tr>
                                    <tr><td>Administrateur: </td><td>&nbsp;&nbsp;<input type="radio" name="choixadmin" value="oui">Oui&nbsp;
                                                                                 <input type="radio" name="choixadmin" value="non" checked="checked">Non</td></tr>

                <!-- Astuce pour passer des paramÃ¨tres Ã  une servlet depuis un formulaire JSP !-->
                <tr><td colspan="2"> <input type="hidden" name="action" value="creerUnUtilisateur"/></td></tr>
                <tr><td colspan="2">  <input type="submit" value="Cr&eacute;er le client" name="submit"/></td>
            </form>
                </table>

                            <p style="color: red" align="center">${requestScope['qquchampsvides']}</p>

                             <p style="color: red" align="center">${requestScope['ClientExisteDeja']}</p>
                        <p style="color: red" align="center">${requestScope['mdp_diff']}</p>

                          <p style="color: green; font-size: 20 " align="center">${requestScope['creaClientOK']}</p>



                        <p style="color: red" align="center">${requestScope['name_requiered']}</p>
                        </c:if>
                   <c:if test="${param['action'] == 'inscription'}"  >
                        <h2 align="center"> Cr&eacute;er un nouveau client Cin&eacute;Shop</h2>


                        

                        <div align="center"><img src="images/addUser.png" title="Cr&eacute;er un client" alt="Add User"></div>
                        <table align="center">
                                <form action="ServletUsers" method="get">

                                    <tr><td> Nom :</td><td>&nbsp; <input type="text" name="nom" value="${requestScope['recup_nom']}"/><td></tr>
                                    <tr><td> Pr&eacute;nom :</td><td>&nbsp; <input type="text" name="prenom" value="${requestScope['recup_prenom']}"/></td></tr>
                                    <tr><td> Email :</td><td>&nbsp; <input type="text" name="email" value="${requestScope['recup_email']}"/></td></tr>
                                    <tr><td>Cr&eacute;ez un mot de passe : </td><td>&nbsp; <input type="password" name="password"/></td></tr>
                                    <tr><td> Retapez le mot de passe :</td><td>&nbsp; <input type="password" name="verif_password"/></td></tr>
                                    <tr><td>Administrateur: </td><td>&nbsp;&nbsp;<input type="radio" name="choixadmin" value="oui">Oui&nbsp;
                                            <input type="radio" name="choixadmin" value="non" checked="checked">Non</td></tr>

                <!-- Astuce pour passer des paramÃ¨tres Ã  une servlet depuis un formulaire JSP !-->
                <tr><td colspan="2"> <input type="hidden" name="action" value="creerUnUtilisateur"/></td></tr>
                <tr><td colspan="2">  <input type="submit" value="Cr&eacute;er le client" name="submit"/></td>
            </form>
                </table>
                        <p style="color: red" align="center">${requestScope['ClientExisteDeja']}</p>
                        <p style="color: red" align="center">${requestScope['mdp_diff']}</p>

                          <p style="color: green" align="center">${requestScope['creaClientOK']}</p>



                        <p style="color: red" align="center">${requestScope['name_requiered']}</p>





</c:if>
                         <%-- Zone pour afficher qques user --%>
                          <!-- Zone qui affiche les utilisateurs si le paramÃ¨tre action vaut listerComptes -->
        <c:if test="${param['action'] == 'afficherUtilisateurs'}" >
            <h2 align="center">Liste des clients de Cin&eacute;Shop</h2>



            <table border="0" align="center">
                <!-- La ligne de titre du tableau des comptes -->
                <tr bgcolor="silver">

                    <td><b>Pr&eacute;nom</b></td>
                    <td><b>Nom</b></td>
                    <td><b>E-mail (identifiant de connexion)</b></td>
                    <td>&nbsp;</td>
                    <td><b>Supprimer&nbsp;</b></td>
                    <td><b>Modifier&nbsp;</b></td>
                </tr>

                <!-- Ici on affiche les lignes, une par utilisateur -->
                <!-- cette variable montre comment on peut utiliser JSTL et EL pour calculer -->
                <c:set var="total" value="0"/>

                <c:forEach var="u" items="${requestScope['listeU']}">
                    <tr>

                        <td width="150">${u.nom}</td>
                        <td width="150">${u.prenom}</td>
                        <td>${u.email}</td>
                        <td><img src="images/inconnu.gif" alt="image" width="40" height="45"> </td>
                        <td align="center"><img src="images/del.png" alt="supprimer" title="Supprimer ce client"> </td>
                        <td align="center"><img src="images/edit.gif" alt="Editer" title="Editer"> </td>
                        <!-- On compte le nombre de users -->
                        <c:set var="total" value="${total+1}"/>
                    </tr>
                </c:forEach>

                <!-- Affichage du solde total dans la derniÃ¨re ligne du tableau -->
                <tr><td colspan="2"><b>TOTAL</b></td> <td><b>${total}</b></td> </tr>
            </table>

        </c:if>
        <%-- fin zone --%>
                    </div>
                </div>

            </div>
        </div>

    </div>

</body>
</html>